package com.yan.design.java8.k5;

import lombok.Data;

import java.lang.annotation.Annotation;

/**
 * @author shengren.yan
 * @create 2022-08-31
 */
@MyAn("ss")
@MyAn("sssss")
@Data
public class UU {

    private String name;

    // 类型注解
    public void setName(@MyAn("aaa") String name){
        this.name = name;
    }

    // 反射得到 注解
    public void doS(){
      Class<UU> uuClass = UU.class;
        Annotation[] annotations = uuClass.getAnnotations(); // 得到注解集合
        for (Annotation a:annotations){
            MyAn ss =  (MyAn) a;
            String value = ss.value();
            System.out.println(value); //得到注解里的值
        }

    }
}
